<%--
  Created by IntelliJ IDEA.
  User: xianfei
  Date: 15-4-15
  Time: 下午3:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
    <title>预定订单管理</title>
    <script>
        $(function () {
            var values = $("[id^=statusValue_]");
            for (var i = 0; i < values.length; i++) {
                $("#status_" + i).val(values.eq(i).val());
            }
        })

        function reserved(guid) {
            $.ajax({
                url:'/reserve/changeStatus/reserved/'+guid,
                type:'GET',
                dataType:'text'
            })
        }
        function noReserve(guid) {
            $.ajax({
                url:'/reserve/changeStatus/notReserve/'+guid,
                type:'GET',
                dataType:'text'
            })
        }
    </script>
</head>
<body>
<div>
    <table class="table table-striped">
        <thead>
        <%--<th width="8%">度假屋图片</th>--%>
        <th width="10%">度假屋名字</th>
        <th width="8%">入住日期</th>
        <th width="8%">入住人</th>
        <th width="12%">身份证</th>
        <th width="8%">联系电话</th>
        <th width="8%">同行人数</th>
        <th width="15%">备注</th>
        <th width="9%">预定状态</th>
        </thead>
        <tbody>
        <c:forEach items="${reserveDTOs}" var="reserveDTOs" varStatus="status">
            <tr>
                <%--<td><img style="width:70px;height:50px;" src="/public/image/${reserveDTOs.houseInfoDTO.imageGuids[0]}"> </td>--%>
                <td>${reserveDTOs.houseInfoDTO.name}</td>
                <td>${reserveDTOs.reserveDate}</td>
                <td>${reserveDTOs.occupancyName}</td>
                <td>${reserveDTOs.IDCard}</td>
                <td>${reserveDTOs.phoneNum}</td>
                <td>${reserveDTOs.peers}</td>
                <td>${reserveDTOs.remarks}</td>
                <td><input type="hidden" id="statusValue_${status.index}" value="${reserveDTOs.status}">
                    <select id="status_${status.index}" class="form-control">
                        <option value="reserved" onclick="reserved('${reserveDTOs.guid}')">已入住</option>
                        <option value="notReserve" onclick="noReserve('${reserveDTOs.guid}')">未入住</option>
                    </select>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>
</body>
</html>